﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using RDPAddins.Common;
using System.Runtime;

namespace RDPAddins
{
    internal class ChannelStream: Stream
    {
        public ChannelStream(IChannel channel) : base() { Channel = channel; }
        IChannel Channel;
        public override bool CanRead { get { return true; } }
        public override bool CanSeek { get { return false; } }
        public override bool CanWrite { get { return true; } }
        public override void Flush() { }
        public override long Length { get { throw new NotImplementedException(); } }
        public override long Seek(long offset, SeekOrigin origin) { throw new NotImplementedException(); }
        public override void SetLength(long value) { throw new NotImplementedException(); }
        [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
        public override int Read(byte[] buffer, int offset, int count) { return Channel.Read(buffer, offset, count); }
        [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
        public override void Write(byte[] buffer, int offset, int count) { Channel.Write(buffer, offset, count); }
        public override long Position
        {
            get { throw new NotImplementedException(); }
            set { throw new NotImplementedException(); }
        }
    }
}
